﻿@model IEnumerable<LotteryVoteMVC.Models.CompanyTypeSupportNumLen>
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>AddLotteryResult</title>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/comm.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/ajaxHelper.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/resource_" + CultureHelper.GetCurrentCulture() + ".js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/comm.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/TableBase.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/inputs.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
            $("input[type='text']").blur(function () {
                var num = $(this).val();
                if (isNullOrEmpty(num)) return;
                var len = $(this).attr("maxlength");
                if (num.length != len)
                    alert(resource.NumNoEnoughLen.format(num, len));
                var count = 0;
                $("input[type='text']").each(function (i, obj) {
                    if ($(obj).val() == num) count++;
                });
                if (count > 1) {
                    var msg = resource.ExistSameNum.format(num);
                    alert(msg);
                }
            }).numeral(true);
        });
    </script>
</head>
<body>
    @using (Html.BeginForm())
    {
       
        <table id="lotteryNums">
            @foreach (var support in Model)
            {
                <tr>
                    <td>
                        @support.NumLen.LenName
                    </td>
                    @for (int i = 0; i < support.Count; i++)
                    {
                        using (Html.BeginCollectionItem("model"))
                        {
                        <td>
                            @Html.TextBox("Value", string.Empty, new { maxlength = support.NumLen.Length, @class = "auto" })
                        </td>
                        }
                    }
                </tr>
            }
        </table>
        
        <div style="padding: 10px; text-align: right">
            <input type="submit" name="submit" id="submit" value="@Resource.Submit" />
            <input type="reset" name="reset" id="reset" value="@Resource.Reset" />
        </div>
    }
</body>
</html>
